
SUB = stack
CC = cc
AR = ar
TARGET = main
RM = -rm -f

OBJECTS = stack.o push.o pop.o is_empty.o
LIB = libstack.a

$(TARGET) : $(OBJECTS)
	$(CC) -c $(wildcard $(SUB)/*.c)
	$(AR) rs $(LIB) $?
	$(CC) main.c -L. -l$(SUB) -I$(SUB) -o $(TARGET)

$(OBJECTS) : $(SUB)/stack.h

.PHONY : clean
clean : 
	$(RM) $(TARGET) $(OBJECTS) $(LIB)


